<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of WriteOff
 *
 * @author Administrator
 */
class GeneralZc extends WMS_Controller
{
    var $users;
    var $whsCode;
    function __construct()
    {
        parent::__construct();
        $gp = gp();
        $userData = $this->session->userdata('users');
        $this->users = $userData;
        $this->whsCode = $userData['user_main_whs_code'];
        //加载模型
        $this->load->service('wms/wait_zc_service');
        $this->load->service('wms/api_service');
        $this->load->service('wms/time_service');
    }

    public function show_wait()
    {
        //锁死仓库
        $whs = $this->whsCode;
        $wherein = array('to_whs_code' => $whs);
        $where = array();
        $gp = gp();
        $sku = $gp['sku'] ? $gp['sku'] : '';
        $page = $gp['page'] ? intval($gp['page']) : 1;
        //
        $str = '?';
        $limit = 15;
        if ('' != $sku)
        {
            array_push($wherein, $sku);
            $str .= 'sku=' . $sku;
        }
        //
        //分页查询
        $this->load->library('pagination');
        $config['page_query_string'] = TRUE;
        $config['base_url'] = blang_url('wms/GeneralZc/show' . $str);
        $config['total_rows'] = $this->wait_zc_service->get_list_count($where = '', $wherein, $like);
        $config['uri_segment'] = config_item('enable_lang') ? 5 : 4;
        $config['per_page'] = $limit;
        $this->pagination->initialize($config);
        $data['pageShow'] = $this->pagination->create_links();
        //分页结束
        //获取产品库存列表
        $receivingList = $this->wait_zc_service->get_list_page(($page-1)*$limit, $limit, $orderstr, $where, $wherein, $like);
        $data['receivingList'] = $this->api_service->fields_erp_product_info($receivingList);
        $data['receivingList']=$this->time_service->show_time($data['receivingList']);
        $data['status_view']=$this->wait_zc_service->get_status();
        $this->load->view('defaults/wms/wait_zc_list', $data);
        $this->load->view('defaults/common/footer', $data);
    }
    public function submit_cgzc($itemId=0)
    {
        if ($itemId != 0)
        {
            $urlParam = @http_build_query($this->input->get());
             $this->wait_zc_service->submit_cgzc_t($itemId,$this->users['account']);
        }
        redirect(blang_url('wms/GeneralZc/show_wait?' . $urlParam));
    }
}

?>
